/**
 * Created by luyanfei on 16-10-7.
 */

var mongoskin = require('mongoskin');
var dbUrl = "mongodb://localhost:27017/blog";
var db = mongoskin.db(dbUrl);
var collections = {
    articles: db.collection("articles"),
    users: db.collections("users")
};

module.exports = function (req, res, next) {
    if(!collections.articles || !collections.users)
        return next(new Error('No collections.'));
    req.collections = collections;
    return next();
};
